home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / Aztec C v5.2a disk 4.adf / 204inc_h.lzh / dos / dos.h < prev    next >
C/C++ Source or Header  |  1991-03-14  |  9KB  |  246 lines

  1. #ifndef DOS_DOS_H
  2. #define DOS_DOS_H
  3. /*
  4. **    $Filename: dos/dos.h $
  5. **    $Release: 2.04 $
  6. **    $Revision: 36.20 $
  7. **    $Date: 91/02/13 $
  8. **
  9. **    Standard C header for AmigaDOS
  10. **
  11. **    (C) Copyright 1985,1986,1987,1988,1989,1990 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include "exec/types.h"
  17. #endif
  18.  
  19.  
  20. #define     DOSNAME  "dos.library"
  21.  
  22. /* Predefined Amiga DOS global constants */
  23.  
  24. #define DOSTRUE (-1L)
  25. #define DOSFALSE (0L)
  26.  
  27. /* Mode parameter to Open() */
  28. #define MODE_OLDFILE         1005   /* Open existing file read/write
  29.                      * positioned at beginning of file. */
  30. #define MODE_NEWFILE         1006   /* Open freshly created file (delete
  31.                      * old file) read/write, exclusive lock. */
  32. #define MODE_READWRITE         1004   /* Open old file w/shared lock,
  33.                      * creates file if doesn't exist. */
  34.  
  35. /* Relative position to Seek() */
  36. #define OFFSET_BEGINNING    -1        /* relative to Begining Of File */
  37. #define OFFSET_CURRENT         0        /* relative to Current file position */
  38. #define OFFSET_END         1        /* relative to End Of File      */
  39.  
  40. #define OFFSET_BEGINING        OFFSET_BEGINNING  /* ancient compatibility */
  41.  
  42. #define BITSPERBYTE         8
  43. #define BYTESPERLONG         4
  44. #define BITSPERLONG         32
  45. #define MAXINT             0x7FFFFFFF
  46. #define MININT             0x80000000
  47.  
  48. /* Passed as type to Lock() */
  49. #define SHARED_LOCK         -2        /* File is readable by others */
  50. #define ACCESS_READ         -2        /* Synonym */
  51. #define EXCLUSIVE_LOCK         -1        /* No other access allowed      */
  52. #define ACCESS_WRITE         -1        /* Synonym */
  53.  
  54. struct DateStamp {
  55.    LONG     ds_Days;          /* Number of days since Jan. 1, 1978 */
  56.    LONG     ds_Minute;          /* Number of minutes past midnight */
  57.    LONG     ds_Tick;          /* Number of ticks past minute */
  58. }; /* DateStamp */
  59.  
  60. #define TICKS_PER_SECOND      50   /* Number of ticks in one second */
  61.  
  62. /* Returned by Examine() and ExNext(), must be on a 4 byte boundary */
  63. struct FileInfoBlock {
  64.    LONG      fib_DiskKey;
  65.    LONG      fib_DirEntryType;  /* Type of Directory. If < 0, then a plain file.
  66.                   * If > 0 a directory */
  67.    char      fib_FileName[108]; /* Null terminated. Max 30 chars used for now */
  68.    LONG      fib_Protection;    /* bit mask of protection, rwxd are 3-0.       */
  69.    LONG      fib_EntryType;
  70.    LONG      fib_Size;         /* Number of bytes in file */
  71.    LONG      fib_NumBlocks;     /* Number of blocks in file */
  72.    struct DateStamp fib_Date;/* Date file last changed */
  73.    char      fib_Comment[80];  /* Null terminated comment associated with file */
  74.    char      fib_Reserved[36];
  75. }; /* FileInfoBlock */
  76.  
  77. /* FIB stands for FileInfoBlock */
  78.  
  79. /* FIBB are bit definitions, FIBF are field definitions */
  80. #define FIBB_SCRIPT    6    /* program is a script (execute) file */
  81. #define FIBB_PURE      5    /* program is reentrant and rexecutable */
  82. #define FIBB_ARCHIVE   4    /* cleared whenever file is changed */
  83. #define FIBB_READ      3    /* ignored by old filesystem */
  84. #define FIBB_WRITE     2    /* ignored by old filesystem */
  85. #define FIBB_EXECUTE   1    /* ignored by system, used by Shell */
  86. #define FIBB_DELETE    0    /* prevent file from being deleted */
  87. #define FIBF_SCRIPT    (1<<FIBB_SCRIPT)
  88. #define FIBF_PURE      (1<<FIBB_PURE)
  89. #define FIBF_ARCHIVE   (1<<FIBB_ARCHIVE)
  90. #define FIBF_READ      (1<<FIBB_READ)
  91. #define FIBF_WRITE     (1<<FIBB_WRITE)
  92. #define FIBF_EXECUTE   (1<<FIBB_EXECUTE)
  93. #define FIBF_DELETE    (1<<FIBB_DELETE)
  94.  
  95. /* Standard maximum length for an error string from fault.  However, most */
  96. /* error strings should be kept under 60 characters if possible.  Don't   */
  97. /* forget space for the header you pass in. */
  98. #define FAULT_MAX    82
  99.  
  100. /* All BCPL data must be long word aligned.  BCPL pointers are the long word
  101.  *  address (i.e byte address divided by 4 (>>2)) */
  102. typedef long  BPTR;            /* Long word pointer */
  103. typedef long  BSTR;            /* Long word pointer to BCPL string     */
  104.  
  105. /* Convert BPTR to typical C pointer */
  106. #ifdef OBSOLETE_LIBRARIES_DOS_H
  107. #define BADDR( bptr )    (((ULONG)bptr) << 2)
  108. #else
  109. /* This one has no problems with CASTing */
  110. #define BADDR(x)    ((APTR)((ULONG)(x) << 2))
  111. #endif
  112. /* Convert address into a BPTR */
  113. #define MKBADDR(x)    (((LONG)(x)) >> 2)
  114.  
  115. /* BCPL strings have a length in the first byte and then the characters.
  116.  * For example:     s[0]=3 s[1]=S s[2]=Y s[3]=S                 */
  117.  
  118. /* returned by Info(), must be on a 4 byte boundary */
  119. struct InfoData {
  120.    LONG      id_NumSoftErrors;    /* number of soft errors on disk */
  121.    LONG      id_UnitNumber;    /* Which unit disk is (was) mounted on */
  122.    LONG      id_DiskState;        /* See defines below */
  123.    LONG      id_NumBlocks;        /* Number of blocks on disk */
  124.    LONG      id_NumBlocksUsed;    /* Number of block in use */
  125.    LONG      id_BytesPerBlock;
  126.    LONG      id_DiskType;        /* Disk Type code */
  127.    BPTR      id_VolumeNode;    /* BCPL pointer to volume node */
  128.    LONG      id_InUse;        /* Flag, zero if not in use */
  129. }; /* InfoData */
  130.  
  131. /* ID stands for InfoData */
  132.     /* Disk states */
  133. #define ID_WRITE_PROTECTED 80     /* Disk is write protected */
  134. #define ID_VALIDATING       81     /* Disk is currently being validated */
  135. #define ID_VALIDATED       82     /* Disk is consistent and writeable */
  136.  
  137.     /* Disk types */
  138. #define ID_NO_DISK_PRESENT    (-1)
  139. #define ID_UNREADABLE_DISK    (0x42414400L)    /* 'BAD\0' */
  140. #define ID_DOS_DISK        (0x444F5300L)    /* 'DOS\0' */
  141. #define ID_FFS_DISK        (0x444F5301L)    /* 'DOS\1' */
  142. #define ID_NOT_REALLY_DOS    (0x4E444F53L)    /* 'NDOS'  */
  143. #define ID_KICKSTART_DISK    (0x4B49434BL)    /* 'KICK'  */
  144. #define ID_MSDOS_DISK        (0x4d534400L)    /* 'MSD\0' */
  145.  
  146. /* Errors from IoErr(), etc. */
  147. #define ERROR_NO_FREE_STORE          103
  148. #define ERROR_TASK_TABLE_FULL          105
  149. #define ERROR_BAD_TEMPLATE          114
  150. #define ERROR_BAD_NUMBER          115
  151. #define ERROR_REQUIRED_ARG_MISSING      116
  152. #define ERROR_KEY_NEEDS_ARG          117
  153. #define ERROR_TOO_MANY_ARGS          118
  154. #define ERROR_UNMATCHED_QUOTES          119
  155. #define ERROR_LINE_TOO_LONG          120
  156. #define ERROR_FILE_NOT_OBJECT          121
  157. #define ERROR_INVALID_RESIDENT_LIBRARY      122
  158. #define ERROR_NO_DEFAULT_DIR          201
  159. #define ERROR_OBJECT_IN_USE          202
  160. #define ERROR_OBJECT_EXISTS          203
  161. #define ERROR_DIR_NOT_FOUND          204
  162. #define ERROR_OBJECT_NOT_FOUND          205
  163. #define ERROR_BAD_STREAM_NAME          206
  164. #define ERROR_OBJECT_TOO_LARGE          207
  165. #define ERROR_ACTION_NOT_KNOWN          209
  166. #define ERROR_INVALID_COMPONENT_NAME      210
  167. #define ERROR_INVALID_LOCK          211
  168. #define ERROR_OBJECT_WRONG_TYPE          212
  169. #define ERROR_DISK_NOT_VALIDATED      213
  170. #define ERROR_DISK_WRITE_PROTECTED      214
  171. #define ERROR_RENAME_ACROSS_DEVICES      215
  172. #define ERROR_DIRECTORY_NOT_EMPTY      216
  173. #define ERROR_TOO_MANY_LEVELS          217
  174. #define ERROR_DEVICE_NOT_MOUNTED      218
  175. #define ERROR_SEEK_ERROR          219
  176. #define ERROR_COMMENT_TOO_BIG          220
  177. #define ERROR_DISK_FULL              221
  178. #define ERROR_DELETE_PROTECTED          222
  179. #define ERROR_WRITE_PROTECTED          223
  180. #define ERROR_READ_PROTECTED          224
  181. #define ERROR_NOT_A_DOS_DISK          225
  182. #define ERROR_NO_DISK              226
  183. #define ERROR_NO_MORE_ENTRIES          232
  184. /* added for 1.4 */
  185. #define ERROR_IS_SOFT_LINK          233
  186. #define ERROR_OBJECT_LINKED          234
  187. #define ERROR_BAD_HUNK              235
  188. #define ERROR_NOT_IMPLEMENTED          236
  189. #define ERROR_RECORD_NOT_LOCKED          240
  190. #define ERROR_LOCK_COLLISION          241
  191. #define ERROR_LOCK_TIMEOUT          242
  192. #define ERROR_UNLOCK_ERROR          243
  193.  
  194. /* error codes 303-305 are defined in dosasl.h */
  195.  
  196. /* These are the return codes used by convention by AmigaDOS commands */
  197. /* See FAILAT and IF for relvance to EXECUTE files              */
  198. #define RETURN_OK                0  /* No problems, success */
  199. #define RETURN_WARN                5  /* A warning only */
  200. #define RETURN_ERROR               10  /* Something wrong */
  201. #define RETURN_FAIL               20  /* Complete or severe failure*/
  202.  
  203. /* Bit numbers that signal you that a user has issued a break */
  204. #define SIGBREAKB_CTRL_C   12
  205. #define SIGBREAKB_CTRL_D   13
  206. #define SIGBREAKB_CTRL_E   14
  207. #define SIGBREAKB_CTRL_F   15
  208.  
  209. /* Bit fields that signal you that a user has issued a break */
  210. /* for example:     if (SetSignal(0,0) & SIGBREAKF_CTRL_C) cleanup_and_exit(); */
  211. #define SIGBREAKF_CTRL_C   (1<<SIGBREAKB_CTRL_C)
  212. #define SIGBREAKF_CTRL_D   (1<<SIGBREAKB_CTRL_D)
  213. #define SIGBREAKF_CTRL_E   (1<<SIGBREAKB_CTRL_E)
  214. #define SIGBREAKF_CTRL_F   ((long)1<<SIGBREAKB_CTRL_F)
  215.  
  216. /* Values returned by SameLock() */
  217. #define LOCK_SAME        0
  218. #define LOCK_SAME_HANDLER    1    /* actually same volume */
  219. #define LOCK_DIFFERENT        -1
  220.  
  221. /* types for ChangeMode() */
  222. #define CHANGE_LOCK    0
  223. #define CHANGE_FH    1
  224.  
  225. /* Values for MakeLink() */
  226. #define LINK_HARD    0
  227. #define LINK_SOFT    1    /* softlinks are not fully supported yet */
  228.  
  229. /* values returned by ReadItem */
  230. #define    ITEM_EQUAL    -2        /* "=" Symbol */
  231. #define ITEM_ERROR    -1        /* error */
  232. #define ITEM_NOTHING    0        /* *N, ;, endstreamch */
  233. #define ITEM_UNQUOTED    1        /* unquoted item */
  234. #define ITEM_QUOTED    2        /* quoted item */
  235.  
  236. /* types for AllocDosObject/FreeDosObject */
  237. #define DOS_FILEHANDLE        0    /* few people should use this */
  238. #define DOS_EXALLCONTROL    1    /* Must be used to allocate this! */
  239. #define    DOS_FIB            2    /* useful */
  240. #define DOS_STDPKT        3    /* for doing packet-level I/O */
  241. #define DOS_CLI            4    /* for shell-writers, etc */
  242. #define DOS_RDARGS        5    /* for ReadArgs if you pass it in */
  243.  
  244. #endif    /* DOS_DOS_H */
  245.  
  246.